<template>
  <wd-config-provider :themeVars="themeVars">
    <slot />
    <wd-toast />
    <wd-message-box />
  </wd-config-provider>
</template>

<script lang="ts" setup>
import { useUserStore } from '@/store'
import { onMounted } from 'vue'
import type { ConfigProviderThemeVars } from 'wot-design-uni'
import { useMessage } from 'wot-design-uni'
const { isLogined } = useUserStore()
const message = useMessage()
onMounted(() => {
  if (!isLogined) {
    message
      .confirm({
        msg: '未登录，请去登录！',
        title: '提示',
      })
      .then(() => {
        uni.switchTab({
          url: '/pages/mine/mine',
        })
        console.log('点击了确定按钮')
      })
      .catch(() => {
        console.log('点击了取消按钮')
      })
  }
})

const themeVars: ConfigProviderThemeVars = {
  // colorTheme: 'red',
  // buttonPrimaryBgColor: '#07c160',
  // buttonPrimaryColor: '#07c160',
}
</script>
